{include file="index@public/header" /}
<style>
        body {
      background: #e1e0de;
    }
    * {
      box-sizing: border-box;
    }
h1,
h2,
h3,
h4 {
  font-weight: 700 !important;
}
.layui-card-header {
  width: 100%;
  border-bottom: 1px solid #999 ;
  padding-left: 5px;
  height: auto;
}
.layui-card {
  padding: 10px 20px 50px;
}
.layui-container {
  padding: 0 !important;
}
img {
  max-width: 100%;
}
::-moz-selection {
  background: #cccccc;
  color: #ffffff;
}
::selection {
  background: #cccccc;
  color: #ffffff;
}
.layui-breadcrumb {
  padding-left: 5px;
}
.layui-card h1 {
  margin: 10px auto 0;
}
.description {
  font-size: 15px;
  font-weight: bold;
  margin: 20px 0;
}

.layui-textarea {
  resize: none !important;
}
.content-left{
  width:75%;padding: 10px 10px;float: left;
}
.content-right{
  width:25%;padding: 10px 10px;float: right;
}
@media screen and (max-width: 800px) {
  .layui-card-header {
    line-height: normal !important;
    font-size: 10px !important;
  }
  .content-left,.content-right{
    width:100%;
  }
}

     
    .layui-card-body{
         padding: 10px 5px;
    }
    .layui-card-body .layui-row .layui-col-sm9 * {
        margin: unset;
        padding: unset;
        list-style: unset;
    }
    .layui-card-body .layui-row .layui-col-sm9 ul {
      padding-left:15px;
    }
    .date{ font-style:italic;color:black;color:#666;;}
    .but{background-color: #0073b1!important;border: 0!important;
      border-radius: 2px!important;
      box-sizing: border-box!important;
      color: #fff!important;
      cursor: pointer!important;
      display: inline-block!important;
      height: 23px;}
    .but:hover,.but:hover a{
      background-color: #08525f !important;
    }
</style>
<div class="layui-container" style='font: 12px/14px arial,helvetica,sans-serif;'>
  <div class="layui-card">
    <span class="layui-breadcrumb" lay-separator="/">
      <a href="/" style='font: 12px/14px arial,helvetica,sans-serif;'>{:lang('Home')}</a>
      {foreach $crumbs as $k=>$v }
      <a href="/{$v['crumbs_url']}" style="font: 12px/14px arial,helvetica,sans-serif;color:#36648A">{$v['alias_name']}</a>
      {/foreach}
      <a style='font: 12px/14px arial,helvetica,sans-serif;color:#333'><cite>{$title}</cite></a>
    </span>

    <div class="layui-card-header">
      <h1>{$title}</h1>
    </div>


    <div class="layui-card-body" style='color: #333;line-height: 24px;'>
      <div class='date'>{:lang('Release time')} : {$create_time}&nbsp;&nbsp;&nbsp;&nbsp;<?php if(config('app.default_lang')=='en-us'){?><a href="https://www.linkedin.com/shareArticle?mini=true&url={:urlencode($url)}&title={:urlencode($title)}"><button class="but" type="button" style=""><xdoor-icon aria-hidden="true"><svg viewBox="0 0 24 24" width="24px" height="24px" x="0" y="0" preserveAspectRatio="xMinYMin meet">
        <g style="fill: currentColor">
          <rect x="-0.003" style="fill:none;" width="24" height="24"></rect>
          <path style="" d="M20,2h-16c-1.1,0-2,0.9-2,2v16c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V4C22,2.9,21.1,2,20,2zM8,19h-3v-9h3V19zM6.5,8.8C5.5,8.8,4.7,8,4.7,7s0.8-1.8,1.8-1.8S8.3,6,8.3,7S7.5,8.8,6.5,8.8zM19,19h-3v-4c0-1.4-0.6-2-1.5-2c-1.1,0-1.5,0.8-1.5,2.2V19h-3v-9h2.9v1.1c0.5-0.7,1.4-1.3,2.6-1.3c2.3,0,3.5,1.1,3.5,3.7V19z"></path>
        </g>
      </svg></xdoor-icon><b style="float:right;padding-top:6px;padding-right:5px">Share</b></button></a><?php }?></div>

      <div class="layui-row">

        <div class="layui-col-sm9 content-left" style="">
          {:htmlspecialchars_decode($content)}
          <?php if($id==2180){?>
          <div class="archives"  style="width:50%;padding: 10px 10px;float: left;">
            <div style="">
              <div style="border:1px solid black;width:80%;margin-left:10%;padding: 10px 10px;border-radius:5px">
                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Bore Diameter')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px'  type="text" id="Bore_Diameter" name="Bore_Diameter">mm
                    </div>
                  </div>
                </div>

                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Outer Diameter')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px' type="text" id="Outer_Diameter" name="Outer_Diameter">mm
                    </div>
                  </div>
                </div>
                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('n')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px' type="text" id="n" name="n">min<sup>-1</sup>
                    </div>
                  </div>
                </div>
                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Pr')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px' type="text" id="Pr" name="Pr">N
                    </div>
                  </div>
                </div>
                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Cr')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px' type="text" id="Cr" name="Cr">N
                    </div>
                  </div>
                </div>
                <div>
                  <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('T')}<span
                          style="color:#36648a;font-size:18px">*</span>:</div>
                  <div style="padding: 2px 5px">
                    <div style="padding-bottom:5px;padding-top:5px">
                      <input style='cursor:text;width:70%;height:30px' type="text" id="T" name="T">°C
                    </div>
                  </div>
                </div>
                <div style="padding:5px;">
                  <div>{:lang('(For single-row deep groove ball bearings only)')}</div>
                  <button class="layui-btn layui-btn-sm" onclick='chuandi()' style="background-color: #FDD702;color:black;font-weight:bold;">{:lang('calculate')}</button>
                  <div id="result"></div>
                </div>


              </div>

            </div>
          </div>
          <?php }?>
          <div style="clear: both;"></div>

          <ul style="margin-top:30px;display: flex;flex-wrap: wrap;">
            <li style="width: calc(100% / 2);">
              <?php if($front){?>
              {:lang('Previous')}:
              <a href="/{:end($crumbs)['crumbs_url']}{$front['url']}/" class="s_prev">{$front['title']}</a>
              <?php }else{?>
              {:lang('no more')}
              <?php }?>
            </li>
            <li style="width: calc(100% / 2);">
              <?php if($after){?>
              {:lang('Next')}:
              <a href="/{:end($crumbs)['crumbs_url']}{$after['url']}/" class="x_next" >{$after['title']}</a>
              <?php }else{?>
              {:lang('no more')}
              <?php }?>
            </li>
          </ul>
        </div>
        <div class="layui-col-sm2 content-right" style="">
          <div class="archives" style="margin:10px 0px;border: 1px solid #D3D4D8;padding:24px;">
            <h3 style="padding-left: 20px;">{:lang('CATEGORIES')}</h3>
            <ul class="archives-ul">
              {volist name="$blogc" id="data"}
              <li style="padding:5px 20px;text-align:left">
                <a href="/{:end($crumbs)['crumbs_url']}categories/{:urlencode(str_replace(' ','-',strtolower($data['title_en'])))}/" style="text-decoration: none"><span class="layui-icon " style='color:#36648a;'>
                                </span>{$data['title']}<span>({$data['num']})</span></a>
              </li>
              {/volist}
              <div style="clear: both;"></div>
            </ul>
          </div>
          <div class="archives" style="margin:10px 0px;border: 1px solid #D3D4D8;padding: 24px;">
            <h3 style="padding-left: 20px;">{:lang('LATEST ARTICLES')}</h3>
            <ul class="archives-ul">
              {volist name="$blog" id="data"}
              <li style="padding:5px 0px;text-align:left">
                <a href="/{:end($crumbs)['crumbs_url']}{$data['url']}/" style="text-decoration: none">
                  <div class="layui-col-sm3" style="text-align:left;" >
                    <img src="{$data['img']}" />
                  </div>
                  <div class="layui-col-sm9">
                    <?php if(config('app.default_lang')=='zh-cn'){?>
                    {:strip_tags(mb_substr($data['title'],0,200))}
                    <?php }else{?>
                    {:strip_tags(substr($data['title'],0,200))}
                    <?php }?>
                  </div>
                </a>
              </li>
              <div style="clear: both;"></div>
              {/volist}

            </ul>
          </div>
          <?php if($id==151){?>
          <div class="archives" style="margin:10px 0px;border: 1px solid #D3D4D8;padding:24px;">
            <div>
              <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Bore Dia')}</div>
              <div style="padding: 2px 5px">
                <div style="padding-bottom:5px;padding-top:5px" >
                  <select style='cursor:pointer;width:100%;height:30px' name="Bore_Dia" id='Bore_Dia_angular' onchange="Bore_Diasel()">
                    <option value="">{:lang('Please choose')}...</option>
                    {foreach $Bore_Dia as $key=>$vo }
                    <option value="<?php echo str_replace('"','\"',$vo['value']);?>">{$vo['value']}</option>
                    {/foreach}
                  </select>
                </div>
              </div>
            </div>

            <div>
              <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Outer Dia')}</div>
              <div style="padding: 2px 5px">
                <div style="padding-bottom:5px;padding-top:5px" >
                  <select style='cursor:pointer;width:100%;height:30px' name="Outer_Dia" id='Outer_Dia_angular' onchange="Bore_Diasel()">
                    <option value="">{:lang('Please choose')}...</option>
                    {foreach $Outer_Dia as $key=>$vo }
                    <option value="<?php echo str_replace('"','\"',$vo['value']);?>">{$vo['value']}</option>
                    {/foreach}
                  </select>
                </div>
              </div>
            </div>

            <div>
              <div style="font-weight:bold;background-color:#EFEFEF;padding:5px;border-radius:2px">{:lang('Width')}</div>
              <div style="padding: 2px 5px">
                <div style="padding-bottom:5px;padding-top:5px">
                  <select style='cursor:pointer;width:100%;height:30px' name="Width" id='Width_angular' onchange="Bore_Diasel()">
                    <option value="">{:lang('Please choose')}...</option>
                    {foreach $Width as $key=>$vo }
                    <option value="<?php echo str_replace('"','\"',$vo['value']);?>">{$vo['value']}</option>
                    {/foreach}
                  </select>
                </div>
              </div>
            </div>
            <div style="margin-left:35%">
              <button class="layui-btn layui-btn-sm" onclick='chuandi2()' style="background-color: #FDD702;color:black;font-weight:bold;">{:lang('SEARCH')}</button>

            </div>
          </div>
          <?php }?>
        </div>
      </div>
    </div>
  </div>
</div>
{include file="/public/footer" /}
<script type="text/javascript">
  function chuandi(){
    var Bore_Diameter = $.trim($("input[name='Bore_Diameter']").val());
    if(Bore_Diameter === "" || Bore_Diameter ==null || Bore_Diameter==0){
      layer.tips('Please fill in the Bore_Diameter', '#Bore_Diameter', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("Bore_Diameter").focus();
      return false;
    }
    var Outer_Diameter = $.trim($("input[name='Outer_Diameter']").val());
    if(Outer_Diameter === "" || Outer_Diameter ==null || Outer_Diameter==0){
      layer.tips('Please fill in the Outer_Diameter', '#Outer_Diameter', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("Outer_Diameter").focus();
      return false;
    }
    var n = $.trim($("input[name='n']").val());
    if(n === "" || n ==null || n==0){
      layer.tips('Please fill in the n', '#n', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("n").focus();
      return false;
    }
    var Pr = $.trim($("input[name='Pr']").val());
    if(Pr === "" || Pr ==null || Pr==0){
      layer.tips('Please fill in the Pr', '#Pr', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("Pr").focus();
      return false;
    }
    var Cr = $.trim($("input[name='Cr']").val());
    if(Cr === "" || Cr ==null || Cr==0){
      layer.tips('Please fill in the Cr', '#Cr', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("Cr").focus();
      return false;
    }
    var T = $.trim($("input[name='T']").val());
    if(T === "" || T ==null || T==0){
      layer.tips('Please fill in the T', '#T', {
        tips: [4, '#5FB878'],
      });
      document.getElementById("T").focus();
      return false;
    }else if(T >120){
      layer.tips('T >120,Please contact with your bearing manufacturer', '#T', {
        tips: [4, '#5FB878'],
      });
      return false;
    }

    var res='';
    var p='';
    var dn='';
    p=Pr/Cr;
    dn=(parseFloat(Bore_Diameter)+parseFloat(Outer_Diameter))/2*n;
    if(T < 50){
      T=50;
    }
    if(p < 0.04){
      p=0.04;
    }
    if(p >0.16){
      layer.tips('Pr/Cr>0.16,Please contact with your bearing manufacturer', '#Pr', {
        tips: [4, '#5FB878'],
      });
      return false;
    }

    if(dn <125000){
      dn=125000;
    }
    if(dn >500000){
      layer.tips('d<sub>m</sub>n does not comply with regulations,Please contact with your bearing manufacturer', '#Bore_Diameter', {
        tips: [4, '#5FB878'],
      });
      return false;
    }
    res=6.10-4.40*Math.pow(10,-6)*dn-3.125*(p-0.04)-(0.021-1.80*Math.pow(10,-8)*dn)*T;
    res=Math.pow(10,res);
    document.getElementById("result").innerHTML='<input disabled="true" style="margin-top:10px;width:70%;height:30px" type="text" value="L='+res.toFixed(2)+ '（h)">';
  }

  function init_selected(){
    $("#Bore_Dia_angular option:selected").prop('selected', false);
    $("#Outer_Dia_angular option:selected").prop('selected', false);
    $("#Width_angular option:selected").prop('selected', false);
    Bore_Diasel()
  }
  function Bore_Diasel(){
    var Bore_Dia   = $("#Bore_Dia_angular option:selected").val();
    var Outer_Dia  = $("#Outer_Dia_angular option:selected").val();
    var Width      = $("#Width_angular option:selected").val();
    Bore_Dia=Bore_Dia.replace("\\","\"");
    Outer_Dia=Outer_Dia.replace("\\","\"");
    Width=Width.replace("\\","\"");

    var formData = new FormData();
    formData.append('Bore_Dia', Bore_Dia);
    formData.append('Outer_Dia', Outer_Dia);
    formData.append('Width', Width);
    $.ajax({
      url: "{:url('index/News/needle_bearings_search_Outer')}",/*传向后台服务器文件*/
      type: 'POST',    /*传递方法 */
      data: formData,  /*要带的值，在这里只能带一个formdata ，不可以增加其他*/
      dataType: 'json',  //传递数据的格式
      async: true, //这是重要的一步，防止重复提交的
      cache: false,  //设置为false，上传文件不需要缓存。
      contentType: false,//设置为false,因为是构造的FormData对象,所以这里设置为false。
      processData: false,//设置为false,因为data值是FormData对象，不需要对数据做处理。

      success: function (res){
        // 内径
        var Bore_Dia_html='<option value="">Please choose...</option>';

        for(var i=0;i<res.Bore_Dia.length;i++){
          var selected = res.Bore_Dia[i]['value'] == Bore_Dia ? 'selected':'';
          Bore_Dia_html+="<option "+ selected +" value='"+res.Bore_Dia[i]["value"]+"'>"+res.Bore_Dia[i]["value"]+"</option>";
        }
        $("#Bore_Dia_angular").html(Bore_Dia_html);

        // 外径
        var Outer_Dia_html='<option value="">Please choose...</option>';
        for(var i=0;i<res.Outer_Dia.length;i++){
          var selected = res.Outer_Dia[i]['value'] == Outer_Dia ? 'selected':'';
          Outer_Dia_html+="<option "+ selected +" value='"+res.Outer_Dia[i]["value"]+"'>"+res.Outer_Dia[i]["value"]+"</option>";
        }
        $("#Outer_Dia_angular").html(Outer_Dia_html);

        // 宽度
        var Width_html='<option value="">Please choose...</option>';
        for(var i=0;i<res.Width.length;i++){
          var selected = res.Width[i]['value'] == Width ? 'selected':'';
          Width_html+="<option "+ selected +" value='"+res.Width[i]["value"]+"'>"+res.Width[i]["value"]+"</option>";
        }
        $("#Width_angular").html(Width_html);
      }
    });
  }


  function chuandi2(){

    var Bore_Dia=$("#Bore_Dia_angular option:selected").val();
    var Outer_Dia=$("#Outer_Dia_angular option:selected").val();
    var Width=$("#Width_angular option:selected").val();
    var url="/roller-bearings/needle-roller-bearings/";
    var str=url+"?";
    if(Bore_Dia!=''&&Bore_Dia!=undefined){
      str+="Bore_Dia="+Bore_Dia;
    }
    if(Outer_Dia!=''&&Outer_Dia!=undefined){
      str+="&Outer_Dia="+Outer_Dia;
    }
    if(Width!=''&&Width!=undefined){
      str+="&Width="+Width;
    }
    window.location.href=str;


  }
</script>
